bootloaders: Always write out bootloader config file
authorColin Walters <walters@verbum.org>
Fri, 4 Apr 2014 01:08:03 +0000 (21:08 -0400)
committerColin Walters <walters@verbum.org>
Fri, 4 Apr 2014 01:08:03 +0000 (21:08 -0400)
There was an attempted optimization to only write if changed, but this
is broken - we always write the bootloader config into a new
directory.

In theory we should only be writing if it changed, but let's not do a
broken optimization.

src/libostree/ostree-bootloader-syslinux.c
src/libostree/ostree-bootloader-uboot.c

index 1d2febecb5ca933c57d9b3687ad40dc502210468..432738150703ebec5cc4cf4cb2f937d2310bb4ae 100644 (file)
@@ -237,14 +237,11 @@ _ostree_bootloader_syslinux_write_config (OstreeBootloader          *bootloader,
 
   new_config_contents = _ostree_sysroot_join_lines (new_lines);
 
-  if (strcmp (new_config_contents, config_contents) != 0)
-    {
-      if (!g_file_replace_contents (new_config_path, new_config_contents,
-                                    strlen (new_config_contents), 
-                                    NULL, FALSE, G_FILE_CREATE_NONE,
-                                    NULL, cancellable, error))
-        goto out;
-    }
+  if (!g_file_replace_contents (new_config_path, new_config_contents,
+                                strlen (new_config_contents), 
+                                NULL, FALSE, G_FILE_CREATE_NONE,
+                                NULL, cancellable, error))
+    goto out;
   
   ret = TRUE;
  out:
index 91d051c45f9ae5bdb4577428fc81a28b01f2fcfe..c56d5ac0138b539b449aed4888a19ab7f9e6ac47 100644 (file)
@@ -125,14 +125,11 @@ _ostree_bootloader_uboot_write_config (OstreeBootloader          *bootloader,
 
   new_config_contents = _ostree_sysroot_join_lines (new_lines);
 
-  if (strcmp (new_config_contents, config_contents) != 0)
-    {
-      if (!g_file_replace_contents (new_config_path, new_config_contents,
-                                    strlen (new_config_contents),
-                                    NULL, FALSE, G_FILE_CREATE_NONE,
-                                    NULL, cancellable, error))
-        return FALSE;
-    }
+  if (!g_file_replace_contents (new_config_path, new_config_contents,
+                                strlen (new_config_contents),
+                                NULL, FALSE, G_FILE_CREATE_NONE,
+                                NULL, cancellable, error))
+    return FALSE;
 
   return TRUE;
 }